package cn.cqie.frame.controller;


import cn.cqie.frame.bo.query.QueryEvaluateTaskBo;
import cn.cqie.frame.entity.EvaluateTask;
import cn.cqie.frame.service.EvaluateTaskService;
import cn.cqie.frame.utils.MyPageHelper;
import cn.cqie.frame.vo.EvaluateTaskVo;
import cn.cqie.frame.vo.ResultVo;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 评教任务 前端控制器
 * </p>
 *
 * @author XYHL
 * @since 2021-10-16
 */
@RestController
@Api("评价任务")
public class EvaluateTaskController {
    @Autowired
    private EvaluateTaskService evaluateTaskService;

    /**
     * 新增/更新评价任务
     * @param po
     * @return
     */
    @ApiOperation("新增/更新评价任务")
    @PostMapping(value = "/evaluateTask/saveOrUpdateEvaluateTask")
    public ResultVo<Void> saveOrUpdateEvaluateTask( @RequestBody EvaluateTask po) {
        Boolean aBoolean = evaluateTaskService.saveOrUpdateEvaluateTask(po);
        return aBoolean ? ResultVo.success() : ResultVo.error("插入/更新失败");
    }
    /**
     * 删除评价指标
     * @param
     * @return
     */
    @ApiOperation("删除评价指标")
    @DeleteMapping("/evaluateTask/deleteEvaluateTask/{EvaluateTaskId}")
    public ResultVo<Void> deleteEvaluateTask(@PathVariable Integer EvaluateTaskId) {
        Boolean delete = evaluateTaskService.deleteEvaluateTask(EvaluateTaskId);
        return delete ? ResultVo.success() : ResultVo.error("删除失败");
    }
    @ApiOperation("查询评价指标信息分页")
    @GetMapping(value = "/evaluateTask/evaluateTaskInfoPage")
    public ResultVo<PageInfo<EvaluateTaskVo>> evaluateTaskInfoPage(QueryEvaluateTaskBo bo) {
        return ResultVo.success(MyPageHelper.returnPage(evaluateTaskService.evaluateTaskInfoPage(bo)));
    }
}

